//
//  YATaskUserUpdateInfo.m
//  YoucApi
//
//  Created by Liam on 12/8/12.
//
//

#import "YATaskUserUpdateInfo.h"

@implementation YATaskUserUpdateInfo

TASK_AUTO_REGISTER(TaskUserUpdateInfo);

- (NSString *)_getUriParamA
{
	return @"save_user_info";
}

- (BOOL)_checkValidResponse:(id)responseObject
{
	return YES;
}

- (void)_dealWithJSONResponse:(id)responseObject withError:(NSError *)error
{
	YARespUserInfo *respUserInfo = [[[YARespUserInfo alloc] initWithError:error context:self.context] autorelease];
	
	YAObjUserInfo * userInfo = [[[YAObjUserInfo alloc] init] autorelease];
	
	userInfo.userId = [self.params objectForKey:KEY_UID];
	
	if ([error code] == YoucApiErrorSuccess)
	{
		userInfo.nickname = [self.params objectForKey:KEY_NICKNAME];
		userInfo.sex = [self.params objectForKey:KEY_SEX];
		userInfo.sign = [self.params objectForKey:KEY_SIGN];
		userInfo.location = [self.params objectForKey:KEY_LOCATION];
		userInfo.photo = [self.params objectForKey:KEY_PHOTO];
	}
	
	respUserInfo.userInfo = userInfo;
	
	if ([self.delegate respondsToSelector:@selector(userGetInfoResponse:respUserInfo:)])
	{
		[self.delegate userGetInfoResponse:self respUserInfo:respUserInfo];
	}
}

@end
